package com.ruoyi.warehouse.service.impl;

import com.ruoyi.warehouse.domain.WareHouseFish;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.ruoyi.warehouse.mapper.WareHouseSnailMapper;
import com.ruoyi.warehouse.domain.WareHouseSnail;
import com.ruoyi.warehouse.service.IWareHouseSnailService;

import java.util.List;
import java.util.Map;

/**
 * 螺Service业务层处理
 *
 * @author 杨彬鑫
 * @date 2021-01-29
 */
@Service
public class WareHouseSnailServiceImpl extends ServiceImpl<WareHouseSnailMapper, WareHouseSnail> implements IWareHouseSnailService {

    @Override
    public List<WareHouseSnail> queryList(WareHouseSnail wareHouseSnail) {
        LambdaQueryWrapper<WareHouseSnail> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(wareHouseSnail.getSnailName())){
            lqw.like(WareHouseSnail::getSnailName ,wareHouseSnail.getSnailName());
        }
        if (wareHouseSnail.getSnailGainDates() != null){
            lqw.ge(WareHouseSnail::getGainDate,wareHouseSnail.getSnailGainDates()[0]);
            lqw.le(WareHouseSnail::getGainDate,wareHouseSnail.getSnailGainDates()[1]);
        }
        if (StringUtils.isNotBlank(wareHouseSnail.getGainMethod())){
            lqw.eq(WareHouseSnail::getGainMethod ,wareHouseSnail.getGainMethod());
        }
        return this.list(lqw);
    }
}
